﻿namespace Smark.Core
{
    using System;

    [Serializable]
    public class DataPage : IDataPage
    {
        private string mOrderField;
        private int mPageIndex;
        private int mPageSize = 10;
        private int mRecordCount;

        public string OrderField
        {
            get
            {
                return this.mOrderField;
            }
            set
            {
                this.mOrderField = value;
            }
        }

        public int PageCount
        {
            get
            {
                int num;
                if (this.PageSize == 0)
                {
                    this.PageSize = 10;
                }
                if ((this.RecordCount % this.PageSize) > 0)
                {
                    num = (this.RecordCount / this.PageSize) + 1;
                }
                else
                {
                    num = this.RecordCount / this.PageSize;
                }
                if (num == 0)
                {
                    num++;
                }
                return num;
            }
        }

        public int PageIndex
        {
            get
            {
                return this.mPageIndex;
            }
            set
            {
                this.mPageIndex = value;
            }
        }

        public int PageSize
        {
            get
            {
                return this.mPageSize;
            }
            set
            {
                this.mPageSize = value;
            }
        }

        public int RecordCount
        {
            get
            {
                return this.mRecordCount;
            }
            set
            {
                this.mRecordCount = value;
            }
        }
    }
}

